<!DOCTYPE html>



  


<html class="theme-next pisces use-motion" lang="zh-Hans">
<head><meta name="generator" content="Hexo 3.8.0">
  <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="theme-color" content="#222">









<meta http-equiv="Cache-Control" content="no-transform">
<meta http-equiv="Cache-Control" content="no-siteapp">
















  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css">







<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css">

<link href="/css/main.css?v=5.1.4" rel="stylesheet" type="text/css">


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon32.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon16.png?v=5.1.4">


  <link rel="mask-icon" href="/images/logo.svg?v=5.1.4" color="#222">





  <meta name="keywords" content="Hexo, NexT">










<meta name="description" content="模型评估与选择经验误差与过拟合机器学习的目的是尽可能获得所有潜在样本的普遍规律 错误率如果m个样本中有a个样本分类错误，则错误率为E=a/m，精度为1-E。 误差模型实际预测值与样本真实值之间的差异。训练集上的误差称训练误差，新样本上的误差称泛化误差。 过拟合&amp;amp;欠拟合过拟合是机器学习的关键障碍。 理想方案：对多个候选模型进行泛化误差评估，选择泛化误差最小的模型。 评估方法抽样出测试集，作为">
<meta property="og:type" content="article">
<meta property="og:title" content="机器学习西瓜书 （二）模型评估与选择">
<meta property="og:url" content="http://yoursite.com/2019/03/01/机器学习西瓜书-（二）模型评估与选择/index.html">
<meta property="og:site_name" content="Avalon">
<meta property="og:description" content="模型评估与选择经验误差与过拟合机器学习的目的是尽可能获得所有潜在样本的普遍规律 错误率如果m个样本中有a个样本分类错误，则错误率为E=a/m，精度为1-E。 误差模型实际预测值与样本真实值之间的差异。训练集上的误差称训练误差，新样本上的误差称泛化误差。 过拟合&amp;amp;欠拟合过拟合是机器学习的关键障碍。 理想方案：对多个候选模型进行泛化误差评估，选择泛化误差最小的模型。 评估方法抽样出测试集，作为">
<meta property="og:locale" content="zh-Hans">
<meta property="og:image" content="http://thyrsi.com/t6/674/1551352209x2728278692.jpg">
<meta property="og:image" content="http://thyrsi.com/t6/674/1551353869x2728278811.jpg">
<meta property="og:image" content="http://thyrsi.com/t6/674/1551354796x2918527038.png">
<meta property="og:image" content="http://thyrsi.com/t6/674/1551355669x2890191655.png">
<meta property="og:image" content="http://thyrsi.com/t6/674/1551357669x2728279033.png">
<meta property="og:image" content="http://thyrsi.com/t6/674/1551359428x2728278692.png">
<meta property="og:image" content="http://thyrsi.com/t6/674/1551359460x2728278692.png">
<meta property="og:image" content="http://thyrsi.com/t6/674/1551360288x2918527038.jpg">
<meta property="og:updated_time" content="2019-03-01T05:11:51.681Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="机器学习西瓜书 （二）模型评估与选择">
<meta name="twitter:description" content="模型评估与选择经验误差与过拟合机器学习的目的是尽可能获得所有潜在样本的普遍规律 错误率如果m个样本中有a个样本分类错误，则错误率为E=a/m，精度为1-E。 误差模型实际预测值与样本真实值之间的差异。训练集上的误差称训练误差，新样本上的误差称泛化误差。 过拟合&amp;amp;欠拟合过拟合是机器学习的关键障碍。 理想方案：对多个候选模型进行泛化误差评估，选择泛化误差最小的模型。 评估方法抽样出测试集，作为">
<meta name="twitter:image" content="http://thyrsi.com/t6/674/1551352209x2728278692.jpg">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Pisces',
    version: '5.1.4',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="http://yoursite.com/2019/03/01/机器学习西瓜书-（二）模型评估与选择/">





  <title>机器学习西瓜书 （二）模型评估与选择 | Avalon</title>
  








</head>

<body itemscope="" itemtype="http://schema.org/WebPage" lang="zh-Hans">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>
	<a href="https://github.com/jarvishou829" class="github-corner" aria-label="View source on GitHub"><svg width="80" height="80" viewbox="0 0 250 250" style="fill:#151513; color:#fff; position: absolute; top: 0; border: 0; right: 0;" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"/><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"/><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"/></svg></a><style>.github-corner:hover .octo-arm{animation:octocat-wave 560ms ease-in-out}@keyframes octocat-wave{0%,100%{transform:rotate(0)}20%,60%{transform:rotate(-25deg)}40%,80%{transform:rotate(10deg)}}@media (max-width:500px){.github-corner:hover .octo-arm{animation:none}.github-corner .octo-arm{animation:octocat-wave 560ms ease-in-out}}</style>
    <header id="header" class="header" itemscope="" itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">Avalon</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle">By Jarvis Hou</p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br>
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br>
            
            归档
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br>
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br>
            
            标签
          </a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="/about/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-user"></i> <br>
            
            关于
          </a>
        </li>
      
        
        <li class="menu-item menu-item-search">
          <a href="/search/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-search"></i> <br>
            
            搜索
          </a>
        </li>
      
        
        <li class="menu-item menu-item-commonweal">
          <a href="/404/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-heartbeat"></i> <br>
            
            公益404
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope="" itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="http://yoursite.com/2019/03/01/机器学习西瓜书-（二）模型评估与选择/">

    <span hidden itemprop="author" itemscope="" itemtype="http://schema.org/Person">
      <meta itemprop="name" content="Jarvis Hou">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/images/blog_logo.jpg">
    </span>

    <span hidden itemprop="publisher" itemscope="" itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Avalon">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">机器学习西瓜书 （二）模型评估与选择</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2019-03-01T13:10:06+08:00">
                2019-03-01
              </time>
            

            

            
          </span>

          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <h1 id="模型评估与选择"><a href="#模型评估与选择" class="headerlink" title="模型评估与选择"></a>模型评估与选择</h1><h2 id="经验误差与过拟合"><a href="#经验误差与过拟合" class="headerlink" title="经验误差与过拟合"></a>经验误差与过拟合</h2><p>机器学习的目的是尽可能获得所有潜在样本的普遍规律</p>
<h3 id="错误率"><a href="#错误率" class="headerlink" title="错误率"></a>错误率</h3><p>如果m个样本中有a个样本分类错误，则错误率为E=a/m，精度为1-E。</p>
<h3 id="误差"><a href="#误差" class="headerlink" title="误差"></a>误差</h3><p>模型实际预测值与样本真实值之间的差异。训练集上的误差称训练误差，新样本上的误差称泛化误差。</p>
<h3 id="过拟合-amp-欠拟合"><a href="#过拟合-amp-欠拟合" class="headerlink" title="过拟合&amp;欠拟合"></a>过拟合&amp;欠拟合</h3><p>过拟合是机器学习的关键障碍。</p>
<p>理想方案：对多个候选模型进行泛化误差评估，选择泛化误差最小的模型。</p>
<h2 id="评估方法"><a href="#评估方法" class="headerlink" title="评估方法"></a>评估方法</h2><p>抽样出测试集，作为泛化误差的估计。通常假设测试样本是从样本真实分分布中，独立同分布采样而得。</p>
<h3 id="留出法"><a href="#留出法" class="headerlink" title="留出法"></a>留出法</h3><p>将数据集D划分为两个互斥的集合：训练集S和测试集T，常见做法大约为2/3~4/5用于训练，剩余用于测试。</p>
<p>注意：</p>
<ul>
<li>训练/测试集尽量保持分布一致性，避免数据划分引入额外误差。（分类任务中，保持样本类别比例相似，可采用分层采样方式）</li>
<li>单次估计不可靠，一般采用多次随机划分，重复进行实验评估，取均值作为最终结果。</li>
</ul>
<h3 id="交叉验证法（K折交叉验证）"><a href="#交叉验证法（K折交叉验证）" class="headerlink" title="交叉验证法（K折交叉验证）"></a>交叉验证法（K折交叉验证）</h3><p>将数据集划分为K个大小相似的互斥自己，每个子集都尽可能保持数据分布一致。每次使用K-1个做训练集，剩下的子集做测试集，进行K次训练和测试，取K个测试结果的均值，K最常见取10.</p>
<p>注意：</p>
<ul>
<li>K折交叉验证通常要随即使用不同划分p次，最终是p次K折交叉验证的均值，常见的有10次10折交叉验证。</li>
<li>留一法：若数据集D包含M个样本，K=M。训练的模型与整体训练的结果最相似，但开销太大。（执行样本次数）</li>
</ul>
<h3 id="自助法"><a href="#自助法" class="headerlink" title="自助法"></a>自助法</h3><p>留出法和交叉验证法保留部分样本用于测试，实际模型的训练集比D小，会因为训练样本大小不同，引入估计偏差。</p>
<p><strong>自助法：</strong> 有放回的进行抽样，使样本和数据等大。</p>
<p>样本在m次采样中始终不被采到的概率为$(1-\frac{1}{m})^m$，取极限值为</p>
<script type="math/tex; mode=display">\lim_{m\rightarrow+\infty} (1-\frac{1}{m})^m=\frac{1}{e}\approx0.368</script><p>约0.368的样本未出现在采样数据集中，可用于测试。</p>
<p>三个优点：</p>
<ul>
<li>训练集和数据集等大</li>
<li>约1/3可用于测试</li>
<li>从初始数据集产生不同训练集，对集成学习等方法有很大好处</li>
</ul>
<p>适用场景：数据集较小，难以有效划分训练/测试集</p>
<p>缺点：产生的数据集改变了初始数据集的分布，会引入估计偏差。所以在数据充足的情况下，留出法和交叉验证法更常用一些。</p>
<h3 id="调参与最终模型"><a href="#调参与最终模型" class="headerlink" title="调参与最终模型"></a>调参与最终模型</h3><p>两类调参：算法调参，模型调参</p>
<h4 id="算法调参："><a href="#算法调参：" class="headerlink" title="算法调参："></a>算法调参：</h4><p>调节算法的参数，称为超参数</p>
<h4 id="模型调参："><a href="#模型调参：" class="headerlink" title="模型调参："></a>模型调参：</h4><p>模型的参数可能很多，深度学习可以上百亿个</p>
<h4 id="调整方式："><a href="#调整方式：" class="headerlink" title="调整方式："></a>调整方式：</h4><p>产生多个候选模型，基于某种评估方法来进行选择。</p>
<h5 id="参数选择"><a href="#参数选择" class="headerlink" title="参数选择"></a>参数选择</h5><p>选定范围和步长变化，从离散的数值中选择。由训练集和验证集确定算法参数后，带入全部训练数据，得到最终模型。</p>
<h2 id="性能度量"><a href="#性能度量" class="headerlink" title="性能度量"></a>性能度量</h2><h3 id="均方误差"><a href="#均方误差" class="headerlink" title="均方误差"></a>均方误差</h3><p>回归任务最常用的的性能度量：均方误差</p>
<script type="math/tex; mode=display">E(f;D)=\frac{1}{m} \sum_{i=1}^m (f(x_i)-y_i)^2</script><p>更一般的，对于数据分布D和概率密度函数p(x)</p>
<script type="math/tex; mode=display">E(f;D)=\int_{x \sim D}(f(x)-y)^2p(x)dx</script><h3 id="错误率-amp-精度"><a href="#错误率-amp-精度" class="headerlink" title="错误率&amp;精度"></a>错误率&amp;精度</h3><h4 id="错误率-1"><a href="#错误率-1" class="headerlink" title="错误率"></a>错误率</h4><p>被错误分类的比率</p>
<script type="math/tex; mode=display">E(f;D)=\frac{1}{m} \sum_{i=1}^m \mathbb I(f(x_i)\ne y_i)</script><script type="math/tex; mode=display">E(f;D)=\int_{x \sim D}\mathbb I(f(x)\ne y)p(x)dx</script><h4 id="精度"><a href="#精度" class="headerlink" title="精度"></a>精度</h4><p>精度为$1-E$</p>
<script type="math/tex; mode=display">acc(f;D)=\frac{1}{m} \sum_{i=1}^m \mathbb I(f(x_i)= y_i)\\=1-E(f;D)</script><script type="math/tex; mode=display">acc(f;D)=\int_{x \sim D}\mathbb I(f(x)=y)p(x)dx\\=1-E(f;D)</script><h3 id="查准率-amp-查全率-amp-F1"><a href="#查准率-amp-查全率-amp-F1" class="headerlink" title="查准率&amp;查全率&amp;F1"></a>查准率&amp;查全率&amp;F1</h3><h4 id="查准率（precision）"><a href="#查准率（precision）" class="headerlink" title="查准率（precision）"></a>查准率（precision）</h4><p>在所有的预测为正例的结果中，有多少真正是正例</p>
<p>分类结果混淆矩阵（注：针对二分问题）</p>
<div class="table-container">
<table>
<thead>
<tr>
<th style="text-align:center">真实情况</th>
<th style="text-align:center">预测结果（正例）</th>
<th style="text-align:center">预测结果（反例）</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:center"><strong>正例</strong></td>
<td style="text-align:center"><font color="#FF0000"> TP（真正例）</font></td>
<td style="text-align:center">FN（）假反例</td>
</tr>
<tr>
<td style="text-align:center"><strong>反例</strong></td>
<td style="text-align:center"><font color="#FF0000"> FP（假正例）</font></td>
<td style="text-align:center">TN（真反例）</td>
</tr>
</tbody>
</table>
</div>
<script type="math/tex; mode=display">P=\frac{TP}{TP+FP}</script><h4 id="查全率（recall）"><a href="#查全率（recall）" class="headerlink" title="查全率（recall）"></a>查全率（recall）</h4><p>在所有的真正正例中，有多少正例被查了出来。</p>
<p>分类结果混淆矩阵</p>
<div class="table-container">
<table>
<thead>
<tr>
<th style="text-align:center">真实情况</th>
<th style="text-align:center">预测结果（正例）</th>
<th style="text-align:center">预测结果（反例）</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:center"><strong>正例</strong></td>
<td style="text-align:center"><font color="#FF0000">TP（真正例）</font></td>
<td style="text-align:center"><font color="#FF0000">FN（假反例）</font></td>
</tr>
<tr>
<td style="text-align:center"><strong>反例</strong></td>
<td style="text-align:center">FP（假正例）</td>
<td style="text-align:center">TN（真反例）</td>
</tr>
</tbody>
</table>
</div>
<script type="math/tex; mode=display">P=\frac{TP}{TP+FN}</script><p><strong>单独一个指标高，不一定有意义</strong></p>
<ul>
<li>都预测为正例，则查全率=1，无意义。</li>
<li>1000个实例里有500个正例，且都正确，则查准率=1，也无意义。</li>
</ul>
<h4 id="P-R曲线"><a href="#P-R曲线" class="headerlink" title="P-R曲线"></a>P-R曲线</h4><p>最优结果为查准率与查全率都尽量高。</p>
<p><strong>P-R曲线画法</strong></p>
<ol>
<li>根据学习器预测结果进行排序，最可能的排在前面。</li>
<li>按顺序逐个把样本作为正例进行预测，计算查全率、查准率。</li>
<li>将查全率设为x轴，查准率为y轴，画图，双高最优。</li>
</ol>
<p><strong>筛选</strong></p>
<ul>
<li>若一条曲线包住了另一条，则包住的优于被包住的。</li>
<li>若互相交错重叠，则根据具体情况判断哪个标准更重要进行取舍。</li>
</ul>
<h4 id="F-1"><a href="#F-1" class="headerlink" title="$F_1$"></a>$F_1$</h4><p>$F_1$是基于查准率与查全率的调和平均（更注重最小值）</p>
<script type="math/tex; mode=display">\frac{1}{F_1}=\frac{1}{2}\times (\frac{1}{P}+\frac{1}{R})</script><script type="math/tex; mode=display">F_1=\frac{2\times P \times R}{P+R}=\frac{2\times TP}{样例总数+TP-TN}</script><p>$F_\beta$是加权调和平均：</p>
<script type="math/tex; mode=display">\frac{1}{F_\beta}=\frac{1}{1+\beta^2}\times (\frac{1}{P}+\frac{\beta^2}{R})</script><script type="math/tex; mode=display">F_\beta=\frac{(1+\beta^2)\times P \times R}{(\beta^2 \times P)+R}</script><p>$\beta=1$等价于$F_1$；$\beta &gt;1$查全率权重更大；$\beta&lt;1$查准率权重更大</p>
<h3 id="全局性能指标"><a href="#全局性能指标" class="headerlink" title="全局性能指标"></a>全局性能指标</h3><p>进行多次训练/测试，会得到多个混淆矩阵；在多个数据集上进行训练/测试，也会产生多个混淆矩阵。评估n个二分类混淆矩阵上的指标有两种方法：</p>
<h4 id="宏指标"><a href="#宏指标" class="headerlink" title="宏指标"></a>宏指标</h4><p>对每一个混淆矩阵，计算P和R取平均值作为整体的P和R。</p>
<script type="math/tex; mode=display">macro\_ P=\frac{1}{n} \sum_{i=1}^{n}P_i</script><script type="math/tex; mode=display">macro\_ R=\frac{1}{n} \sum_{i=1}^{n}R_i</script><script type="math/tex; mode=display">macro\_F_1=\frac{2\times macro\_P \times macro\_R}{macro\_P +macro\_R}</script><h4 id="微指标"><a href="#微指标" class="headerlink" title="微指标"></a>微指标</h4><p>对TP、FP等值求平均值然后带入计算P、R值。</p>
<script type="math/tex; mode=display">micro\_P=\frac{\overline {TP}}{\overline {TP}+\overline {FP}}</script><script type="math/tex; mode=display">micro\_R=\frac{\overline {TP}}{\overline {TP}+\overline {FN}}</script><script type="math/tex; mode=display">micro\_F_1=\frac{2\times micro\_P \times micro\_R}{micro\_P +micro\_R}</script><h3 id="ROC-amp-AUC"><a href="#ROC-amp-AUC" class="headerlink" title="ROC&amp;AUC"></a>ROC&amp;AUC</h3><h4 id="ROC"><a href="#ROC" class="headerlink" title="ROC"></a>ROC</h4><p>受试者工作特征(Receiver Operating Characteristic)，源于二战应用于敌机检测的雷达信号分析技术。生成过程与PR曲线类似，只是横轴为假正例率，纵轴为真正例率。<br><strong>真正例率&amp;假正例率</strong><br>分类结果混淆矩阵</p>
<div class="table-container">
<table>
<thead>
<tr>
<th style="text-align:center">真实情况</th>
<th style="text-align:center">预测结果（正例）</th>
<th style="text-align:center">预测结果（反例）</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:center"><strong>正例</strong></td>
<td style="text-align:center"><table><tr><td bgcolor="#D1EEEE"><font color="#FF0000">TP（真正例）</font></td></tr></table></td>
<td style="text-align:center"><table><tr><td bgcolor="#D1EEEE">FN（假反例）</td></tr></table></td>
</tr>
<tr>
<td style="text-align:center"><strong>反例</strong></td>
<td style="text-align:center"><table><tr><td bgcolor="#C0FF3E"><font color="#FF0000">FP（假正例）</font> </td></tr></table></td>
<td style="text-align:center"><table><tr><td bgcolor="#C0FF3E">TN（真反例）</td></tr></table></td>
</tr>
</tbody>
</table>
</div>
<script type="math/tex; mode=display">TPR=\frac{TP}{TP+FN}</script><script type="math/tex; mode=display">FPR=\frac{FP}{TN+FP}</script><p><strong>ROC曲线</strong><br>画法：</p>
<ol>
<li>假设有$m_+$个正例，$m_-$个反例，根据预测结果进行排序，正例可能性大的在前面</li>
<li>将分类阈值依次设为每个样例的预测值，计算$(假正例率,真正例率)$</li>
<li>前一个标记为$(x,y)$；若当前为正例，则坐标为$(x,y+\frac{1}{m_+})$，若当前为反例，则坐标为$(x+\frac{1}{m_-},y)$。画图，曲线越偏向左上角越优。</li>
</ol>
<p>注意：</p>
<ul>
<li>包起来的情况，外面的曲线优</li>
<li>对角线代表随机模型，完全不看预测结果按某种比例随机猜，曲线若低于对角线，必然是不可用的</li>
</ul>
<h4 id="AUC-Area-Under-ROC-Curve"><a href="#AUC-Area-Under-ROC-Curve" class="headerlink" title="AUC(Area Under ROC Curve)"></a>AUC(Area Under ROC Curve)</h4><p>ROC曲线一般交叉重叠，为了判断更优的情况，计算AUC值，即ROC曲线下面积，AUC越大越优。<br>估算AUC面积：</p>
<script type="math/tex; mode=display">AUC=\frac{1}{2} \sum_{i=1}^{m-1}(x_{i+1}-x_i)(y_i+y_{i+1})</script><p><strong>排序损失（D为响应实例的集合）：</strong></p>
<script type="math/tex; mode=display">\iota _{rank}=\frac{1}{m^+m^-} \sum_{x^+\in D^+}\sum_{x^-\in D^-}\large( \mathbb I\big( \small f\small(x^+\small)<f\small(x^-\small)\big)+\small\frac{1}{2}\large\mathbb I \big(\small f(x^+)=f(x^-)\big)\large)</script><p>若正例的预测值小于反例，则罚1分，若等于，罚0.5分。<br><img src="http://thyrsi.com/t6/674/1551352209x2728278692.jpg" alt=""></p>
<p>则有</p>
<script type="math/tex; mode=display">AUC=1-\iota_{rank}</script><h3 id="代价敏感错误率-amp-代价曲线"><a href="#代价敏感错误率-amp-代价曲线" class="headerlink" title="代价敏感错误率&amp;代价曲线"></a>代价敏感错误率&amp;代价曲线</h3><h4 id="代价矩阵"><a href="#代价矩阵" class="headerlink" title="代价矩阵"></a>代价矩阵</h4><p>两类错误不一定等价，例如把病人误诊为健康人，把健康人误诊为病人。</p>
<p>二分类代价矩阵</p>
<div class="table-container">
<table>
<thead>
<tr>
<th style="text-align:center">真实类别</th>
<th style="text-align:center">预测类别（第0类）</th>
<th style="text-align:center">预测类别（第1类）</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:center"><strong>第0类</strong></td>
<td style="text-align:center">0</td>
<td style="text-align:center">$cost_{01}$</td>
</tr>
<tr>
<td style="text-align:center"><strong>第1类</strong></td>
<td style="text-align:center">$cost_{10}$</td>
<td style="text-align:center">0</td>
</tr>
</tbody>
</table>
</div>
<h4 id="代价敏感错误率"><a href="#代价敏感错误率" class="headerlink" title="代价敏感错误率"></a>代价敏感错误率</h4><script type="math/tex; mode=display">E(f;D;cost)=\frac{1}{m}\huge(\small \sum_{x_i\in D^+} \mathbb I(f(x_i)\ne y_i)\times cost_{01} +\sum_{x_i\in D^-}\mathbb I(f(x_i)\ne y_i)\times cost_{10}\huge)</script><h4 id="代价曲线图"><a href="#代价曲线图" class="headerlink" title="代价曲线图"></a>代价曲线图</h4><p>非均等代价下，ROC曲线不能反映学习器期望的总体代价，而改用代价曲线。<br>x轴，为正例概率代价（数值不重要，比例重要）：</p>
<script type="math/tex; mode=display">P(+)cost=\frac{p\times cost_{01}}{p\times cost_{01}+(1-p)\times cost_{10}}</script><p>（图中p是样例为正例的概率）</p>
<p>y轴，归一化代价：</p>
<script type="math/tex; mode=display">cost_{norm}=\frac{FNR\times p\times cost_{01}+FPR\times (1-p)\times cost_{10}}{p\times cost_{01}+(1-p)\times cost_{10}}</script><p>其中，FPR是假正例率，FNR=1-TPR，是假反例率。</p>
<h4 id="总体代价期望"><a href="#总体代价期望" class="headerlink" title="总体代价期望"></a>总体代价期望</h4><p>ROC曲线上的点为$(FPR,TPR)$，可计算出FPR和FNR，画出从$(0,FPR)$到$(1,FNR)$的线段，线段下面即为该条件下的期望总代价：<br><img src="http://thyrsi.com/t6/674/1551353869x2728278811.jpg" alt=""><br>取所有线段下界，围成的面积是所有条件下，学习器的期望总体代价。</p>
<h2 id="比较检验"><a href="#比较检验" class="headerlink" title="比较检验"></a>比较检验</h2><p>性能比较的重要因素：</p>
<ol>
<li>测试集上的泛化性能，未必是真的泛化性能。</li>
<li>测试集本身的选择，会由于大小不同，也会不同结果；大小相同，样例不同，也会不同。</li>
<li>很多机器学习算法具有一定随机性，相同参数在同一测试集多次运行，结果会不同。</li>
</ol>
<p>通过统计假设检验的方式，判断泛化性能是否在统计意义上较优，这个结论的把握有多大。<strong>以下以错误率为性能度量进行说明。</strong></p>
<h3 id="假设检验"><a href="#假设检验" class="headerlink" title="假设检验"></a>假设检验</h3><p>繁华错误率与测试错误率未必相同，但直观上，相差不大的可能性较大，可根据测试错误率估算泛化错误率。繁华错误率被测得是测试错误率的概率：</p>
<script type="math/tex; mode=display">P(\hat \epsilon;\epsilon)=\begin{pmatrix}m\\\hat \epsilon \times m\end{pmatrix} \epsilon^{\hat \epsilon \times m}(1-\epsilon)^{m-\hat \epsilon \times m}</script><p>若错误率=0.3，则10个样本中，测得3个被误分类的概率最大。<br><img src="http://thyrsi.com/t6/674/1551354796x2918527038.png" alt=""></p>
<p>$1-\alpha$反映结论的置信度：</p>
<script type="math/tex; mode=display">\overline \epsilon=max\epsilon \space\space\space\space s.t.\space\space \sum_{i=\epsilon_0\times m+1}^m \begin{pmatrix}m\\i\end{pmatrix}\epsilon^i (1-\epsilon)^{m-i}<\alpha</script><p>多次重复实验，取平均测试错误率和方差：</p>
<script type="math/tex; mode=display">\mu=\frac{1}{k}\sum_{i=1}^k \hat \epsilon_i</script><script type="math/tex; mode=display">\sigma^2=\frac{1}{k-1}\sum_{i-1}^{k}(\hat \epsilon_i-\mu)^2</script><p>t分布：正态分布数据，进行抽样K，均值满足自由度为K-1的t分布。</p>
<p>k个测试错误率可看作泛化错误率的独立采样：</p>
<script type="math/tex; mode=display">\tau_t=\frac{\sqrt k (\mu - \epsilon_0)}{\sigma}</script><p>服从自由度为k-1的t分布：<br><img src="http://thyrsi.com/t6/674/1551355669x2890191655.png" alt=""></p>
<p>常用临界值表自查</p>
<h3 id="交叉验证t检验"><a href="#交叉验证t检验" class="headerlink" title="交叉验证t检验"></a>交叉验证t检验</h3><p>同一份数据，两个学习器A和B，利用k折交叉验证法，分别获得k个测试错误率，比较两个学习器性能。</p>
<p><strong>基本思想：</strong> 若两个学习器性能相同，使用相同训练/测试集获得的错误率应相同。</p>
<p>获得错误率的差，进行t检验，构造变量：</p>
<script type="math/tex; mode=display">\tau_t=\left| \frac{\sqrt k \mu}{\sigma} \right|</script><p>制定置信度，自由度为k-1.</p>
<p><strong>重要前提：</strong> 测试错误率均为泛化误差的独立采样。</p>
<p><strong>测试错误率并不独立：</strong> 不同轮次，训练集有重叠，造成过高估计假设成立的概率。</p>
<p>改进：5*2交叉验证。（5次2折交叉验证）<br>第一次2折交叉验证数据没有重叠，可缓解测试错误率，取平均值。</p>
<script type="math/tex; mode=display">\mu=0.5(\Delta_1^1+\Delta_1^2)</script><p>计算每次交叉验证的方差：</p>
<script type="math/tex; mode=display">\sigma_i^2=(\Delta_i^1-\frac{\Delta_i^1+\Delta_i^2}{2})^2+(\Delta_i^2-\frac{\Delta_i^1+\Delta_i^2}{2})^2</script><p>构造t检验变量：</p>
<script type="math/tex; mode=display">\tau_t=\frac{\mu}{\sqrt {0.2 \sum_{i=1}^{5} \sigma_i^2}}</script><p>自由度为5，设定双边检测临界值。</p>
<h3 id="McNemar检验"><a href="#McNemar检验" class="headerlink" title="McNemar检验"></a>McNemar检验</h3><p>医学上用于检测引入某药物后，病人变化是否统计上显著。<br>比较两个学习器的测试错误率：</p>
<p>两学习器分类差别列联表</p>
<div class="table-container">
<table>
<thead>
<tr>
<th style="text-align:center">算法B</th>
<th style="text-align:center">算法A（正确）</th>
<th style="text-align:center">算法A（错误）</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:center"><strong>正确</strong></td>
<td style="text-align:center">$e_{00}$</td>
<td style="text-align:center">$e_{01}$</td>
</tr>
<tr>
<td style="text-align:center"><strong>错误</strong></td>
<td style="text-align:center">$e_{10}$</td>
<td style="text-align:center">$e_{11}$</td>
</tr>
</tbody>
</table>
</div>
<p>如果两个学习器性能相同，应该$e_{01}=e_{10}$，变量$|e_{01}-e_{10}|$服从正态分布。</p>
<p>构造McNemar检验变量：</p>
<script type="math/tex; mode=display">\tau_{\chi^2}=\frac{(|e_{01}-e_{10}|-1)^2}{e_{01}+e_{10}}</script><p>服从自由度为1的卡方分布，即标准正态分布变量的平方（$e_{01}+e_{10}$通常很小，需要考虑连续性校正，所以分子有-1项）</p>
<h3 id="Friedman检验"><a href="#Friedman检验" class="headerlink" title="Friedman检验"></a>Friedman检验</h3><p>利用基于排序的Friedman检验，比较同一数据集上的多个算法<br><img src="http://thyrsi.com/t6/674/1551357669x2728279033.png" alt=""></p>
<p>N个数据集，比较k个算法，$r_i$表示第i个算法，则其均值为$\frac{k+1}{2}$，方差为$\frac{k^2-1}{12}$。</p>
<p><strong>原始Friedman检验</strong></p>
<script type="math/tex; mode=display">\tau_{\chi^2}=\frac{k-1}{k}\frac{12N}{k^2-1}\sum_{i=1}^k (r_i-\frac{k+1}{2})^2\\=\frac{12N}{k(k+1)}(\sum_{i=1}^k r_i^2-\frac{k(k+1)^2}{4})</script><p>在k和N都比较大时，服从自由度为k-1的卡方分布。上述检验较保守，现在通常使用：</p>
<script type="math/tex; mode=display">\tau_F=\frac{(N-1)\tau_{\chi^2}}{N(k-1)-\tau_{\chi^2}}</script><p>服从自由度为k-1和(k-1)(N-1)的F分布。</p>
<p><strong>F分布</strong></p>
<p>若总体$X\sim N(0,1)$，$(X_1,X_2,……X_{n_1})$与$(X_1,X_2,……X_{n_2})$为来自X的两个独立样本，设统计量</p>
<script type="math/tex; mode=display">F=\frac{\sum_{i=1}^{n_1}X_i^2}{n_1}/\frac{\sum_{i=1}^{n_2}Y_i^2}{n_2}</script><p>则称统计量F服从自由度为$n_1$，$n_2$的F分布，记为$F\sim F(n_1,n_2)$</p>
<p>临界值表自查</p>
<h3 id="Nemenyi检验"><a href="#Nemenyi检验" class="headerlink" title="Nemenyi检验"></a>Nemenyi检验</h3><p><strong>所有算法的性能相同</strong> 拒绝这个假设说明不完全相同，接下来进行后续检验，区分各个算法。</p>
<p>Nemenyi检验计算出平均值差别的临界值域：</p>
<script type="math/tex; mode=display">CD=q_\alpha \sqrt{\frac{k(k+1)}{6N}}</script><p>若两个算法的平均序值超过临界值CD，拒绝两个算法性能相同这一假设。</p>
<p>Nemenyi检验中常用值<br><img src="http://thyrsi.com/t6/674/1551359428x2728278692.png" alt=""></p>
<p>算法结果比较<br><img src="http://thyrsi.com/t6/674/1551359460x2728278692.png" alt=""></p>
<p>上图A与B，B与C有交集，但A与C没有交集，所以A与C是有区别的。</p>
<h2 id="偏差-amp-方差"><a href="#偏差-amp-方差" class="headerlink" title="偏差&amp;方差"></a>偏差&amp;方差</h2><p><strong>偏差-方差分解</strong> ，是试图对学习算法的期望泛化错误率进行拆解。同一算法在不同训练集上学习结果很可能不同。</p>
<h3 id="定义"><a href="#定义" class="headerlink" title="定义"></a>定义</h3><p>测试样本x，y；D为x在数据集的标记，y是x的真实标记，f(x,D)为预测值</p>
<h3 id="回归任务"><a href="#回归任务" class="headerlink" title="回归任务"></a>回归任务</h3><p>回归任务的期望预测为：</p>
<script type="math/tex; mode=display">\overline f(x)=\mathbb E_D[f(x;D)]</script><p>使用样本数相同的不同训练集产生的方差：</p>
<script type="math/tex; mode=display">var(x)=\mathbb E_D[(f(x;D)-\overline f(x))^2]</script><p>噪声为：</p>
<script type="math/tex; mode=display">\epsilon_2=\mathbb E_D[(y_D-y)^2]</script><p>期望输出与真实标记的差别成为偏差(bias)：</p>
<script type="math/tex; mode=display">bias^2(x)=(\overline f(x)-y)^2</script><p>对算法的期望泛化误差进行分解化简，结果为：</p>
<script type="math/tex; mode=display">E(f;D)=bias^2(x)+var(x)+\epsilon^2</script><p>学习器性能变化：训练不够时，偏差大，占主要的；训练加深，特征越学越多，过拟合，方差大。<br><img src="http://thyrsi.com/t6/674/1551360288x2918527038.jpg" alt=""></p>

      
    </div>
    
    
    

    

    

    

    <footer class="post-footer">
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2019/02/25/机器学习西瓜书-（一）基础知识/" rel="next" title="机器学习西瓜书 （一）基础知识">
                <i class="fa fa-chevron-left"></i> 机器学习西瓜书 （一）基础知识
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2019/03/01/机器学习西瓜书-（三）线性模型/" rel="prev" title="机器学习西瓜书 （三）线性模型">
                机器学习西瓜书 （三）线性模型 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope="" itemtype="http://schema.org/Person">
            
              <img class="site-author-image" itemprop="image" src="/images/blog_logo.jpg" alt="Jarvis Hou">
            
              <p class="site-author-name" itemprop="name">Jarvis Hou</p>
              <p class="site-description motion-element" itemprop="description">生如逆旅 一苇以航</p>
          </div>

          <nav class="site-state motion-element">

            
              <div class="site-state-item site-state-posts">
              
                <a href="/archives/">
              
                  <span class="site-state-item-count">4</span>
                  <span class="site-state-item-name">日志</span>
                </a>
              </div>
            

            

            

          </nav>

          

          

          
          

          
          

          

        </div>
      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#模型评估与选择"><span class="nav-number">1.</span> <span class="nav-text">模型评估与选择</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#经验误差与过拟合"><span class="nav-number">1.1.</span> <span class="nav-text">经验误差与过拟合</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#错误率"><span class="nav-number">1.1.1.</span> <span class="nav-text">错误率</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#误差"><span class="nav-number">1.1.2.</span> <span class="nav-text">误差</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#过拟合-amp-欠拟合"><span class="nav-number">1.1.3.</span> <span class="nav-text">过拟合&amp;欠拟合</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#评估方法"><span class="nav-number">1.2.</span> <span class="nav-text">评估方法</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#留出法"><span class="nav-number">1.2.1.</span> <span class="nav-text">留出法</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#交叉验证法（K折交叉验证）"><span class="nav-number">1.2.2.</span> <span class="nav-text">交叉验证法（K折交叉验证）</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#自助法"><span class="nav-number">1.2.3.</span> <span class="nav-text">自助法</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#调参与最终模型"><span class="nav-number">1.2.4.</span> <span class="nav-text">调参与最终模型</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#算法调参："><span class="nav-number">1.2.4.1.</span> <span class="nav-text">算法调参：</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#模型调参："><span class="nav-number">1.2.4.2.</span> <span class="nav-text">模型调参：</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#调整方式："><span class="nav-number">1.2.4.3.</span> <span class="nav-text">调整方式：</span></a><ol class="nav-child"><li class="nav-item nav-level-5"><a class="nav-link" href="#参数选择"><span class="nav-number">1.2.4.3.1.</span> <span class="nav-text">参数选择</span></a></li></ol></li></ol></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#性能度量"><span class="nav-number">1.3.</span> <span class="nav-text">性能度量</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#均方误差"><span class="nav-number">1.3.1.</span> <span class="nav-text">均方误差</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#错误率-amp-精度"><span class="nav-number">1.3.2.</span> <span class="nav-text">错误率&amp;精度</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#错误率-1"><span class="nav-number">1.3.2.1.</span> <span class="nav-text">错误率</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#精度"><span class="nav-number">1.3.2.2.</span> <span class="nav-text">精度</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#查准率-amp-查全率-amp-F1"><span class="nav-number">1.3.3.</span> <span class="nav-text">查准率&amp;查全率&amp;F1</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#查准率（precision）"><span class="nav-number">1.3.3.1.</span> <span class="nav-text">查准率（precision）</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#查全率（recall）"><span class="nav-number">1.3.3.2.</span> <span class="nav-text">查全率（recall）</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#P-R曲线"><span class="nav-number">1.3.3.3.</span> <span class="nav-text">P-R曲线</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#F-1"><span class="nav-number">1.3.3.4.</span> <span class="nav-text">$F_1$</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#全局性能指标"><span class="nav-number">1.3.4.</span> <span class="nav-text">全局性能指标</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#宏指标"><span class="nav-number">1.3.4.1.</span> <span class="nav-text">宏指标</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#微指标"><span class="nav-number">1.3.4.2.</span> <span class="nav-text">微指标</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#ROC-amp-AUC"><span class="nav-number">1.3.5.</span> <span class="nav-text">ROC&amp;AUC</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#ROC"><span class="nav-number">1.3.5.1.</span> <span class="nav-text">ROC</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#AUC-Area-Under-ROC-Curve"><span class="nav-number">1.3.5.2.</span> <span class="nav-text">AUC(Area Under ROC Curve)</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#代价敏感错误率-amp-代价曲线"><span class="nav-number">1.3.6.</span> <span class="nav-text">代价敏感错误率&amp;代价曲线</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#代价矩阵"><span class="nav-number">1.3.6.1.</span> <span class="nav-text">代价矩阵</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#代价敏感错误率"><span class="nav-number">1.3.6.2.</span> <span class="nav-text">代价敏感错误率</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#代价曲线图"><span class="nav-number">1.3.6.3.</span> <span class="nav-text">代价曲线图</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#总体代价期望"><span class="nav-number">1.3.6.4.</span> <span class="nav-text">总体代价期望</span></a></li></ol></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#比较检验"><span class="nav-number">1.4.</span> <span class="nav-text">比较检验</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#假设检验"><span class="nav-number">1.4.1.</span> <span class="nav-text">假设检验</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#交叉验证t检验"><span class="nav-number">1.4.2.</span> <span class="nav-text">交叉验证t检验</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#McNemar检验"><span class="nav-number">1.4.3.</span> <span class="nav-text">McNemar检验</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#Friedman检验"><span class="nav-number">1.4.4.</span> <span class="nav-text">Friedman检验</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#Nemenyi检验"><span class="nav-number">1.4.5.</span> <span class="nav-text">Nemenyi检验</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#偏差-amp-方差"><span class="nav-number">1.5.</span> <span class="nav-text">偏差&amp;方差</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#定义"><span class="nav-number">1.5.1.</span> <span class="nav-text">定义</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#回归任务"><span class="nav-number">1.5.2.</span> <span class="nav-text">回归任务</span></a></li></ol></li></ol></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <script async src="https://dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js"></script>
<div class="copyright">&copy; <span itemprop="copyrightYear">2019</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Jarvis Hou</span>

  
</div>


  <div class="powered-by">驱动者是 Hexo desu~</div>



  <span class="post-meta-divider">|</span>



  <div class="theme-info">主题嘛~是 NexT poi</div>



        







        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  












  
  
    <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>
  

  
  
    <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
  


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.4"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.4"></script>



  
  


  <script type="text/javascript" src="/js/src/affix.js?v=5.1.4"></script>

  <script type="text/javascript" src="/js/src/schemes/pisces.js?v=5.1.4"></script>



  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.4"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.4"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.4"></script>



  


  




	





  





  












  





  

  

  

  
  

  
  
    <script type="text/x-mathjax-config">
      MathJax.Hub.Config({
        tex2jax: {
          inlineMath: [ ['$','$'], ["\\(","\\)"]  ],
          processEscapes: true,
          skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
        }
      });
    </script>

    <script type="text/x-mathjax-config">
      MathJax.Hub.Queue(function() {
        var all = MathJax.Hub.getAllJax(), i;
        for (i=0; i < all.length; i += 1) {
          all[i].SourceElement().parentNode.className += ' has-jax';
        }
      });
    </script>
    <script type="text/javascript" src="//cdn.bootcss.com/mathjax/2.7.1/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
  


  

  

</body>
</html>
